<%@page import="java.awt.print.Printable"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
<head>
<title>_${customer.customerName}_保修单重新打印</title>
<script type="text/javascript">
  var single_array=new Array();
  var multi_array=new Array();

  $(function() {
		$("#queryForm").validate(); 
		$("input[type='checkbox']").attr("checked",false);
		
		bindCheckBox("alreadyMyCheckedAll","alreadyMyChecked");
  });
  
  //全选事件
  function myCheckedAll(item){
	$("input[name='"+item+"_myChecked']").attr("checked",$("#"+item+"_myCheckedAll").is(":checked"));
  }

  //单选事件	
  function myChecked(type,item) {
	if ($("#"+type+"_check" + item).is(":checked")) {
	} else {
		$("#"+type+"_myCheckedAll").attr("checked", false);
	}
  }
  var status = '${status}';
 var allLength='${fn:length(orderList)}';
	
	function initWorkBatchSyntony(){
	      waitOrder=Number(waitOrder);
	      if(waitOrder==0){
	        showAdMsg();
	      }
	}
	
	function allMyChecked(item){
	   allLength=Number(allLength);
	   item=Number(item);
	     if(!$("#check_already" + item).is(":checked")){
	            for(var i=0;i<allLength;i++,item++){
	                if(document.getElementById("check_already" + item)){
	                 $("#check_already" + item).attr("checked", true);
	                }
	           }
	     }else{
	       for(var i=0;i<allLength;i++,item++){
	                if(document.getElementById("check_already" + item)){
	                 $("#check_already" + item).attr("checked", false);
	                }
	           }
	     }
	}

</script>
</head>

<body>
<div id="fullbg"></div>
<div id="dialog">
	<div>
		<img src="${ctx }/static/022.gif"></img>
	</div>
	</div>
	<script type="text/javascript">
	  //半通明遮罩
document.writeln("<div id=\"divGg\" style=\"Z-INDEX:9999; LEFT:0px;POSITION:absolute; TOP:0px;display:none;background-color:#000;-moz-opacity: 0.3; opacity: 0.3; filter:alpha(opacity=30);\"></div>");
var divGg = document.getElementById("divGg");
//弹出层
var tempAlert="<div id=\"divAdMsg\" style=\"Z-INDEX:99999; LEFT:10px;top:50px;POSITION:absolute;height:200px; width:500px;display:none;background-color:#FFF;\">"+
"<div style=\"LEFT:30px;top:50px;POSITION:relative;\"><font size=\"5\">该批次已经打印完毕，请及时回传运单号!</font></div><div style=\"LEFT:120px;top:100px;POSITION:relative;\"><a href=\"javascript:ajaxWorkBatchSyntony('${workBatch.id }');\" class=\"btn btn-danger btn-large\"/>回传运单号</a>&nbsp;<a href=\"javascript:closeAdMsg();\" class=\"btn btn-large\"/>暂时不回传</a></div></div>";
tempAlert="<div id=\"divAdMsg\" style=\"Z-INDEX:99999; LEFT:10px;top:50px;POSITION:absolute;height:200px; width:500px;display:none;background-color:#FFF;\">"+
"<div style=\"LEFT:30px;top:50px;POSITION:relative;\"><font size=\"7\">该批次已经打印完毕</font></div><div style=\"LEFT:70px;top:100px;POSITION:relative;\" ><font size=\"7\" color=\"red\" id=\"sysMessage\">回传订单号成功</font></div></div>";
document.writeln(tempAlert);
var divAdMsg = document.getElementById("divAdMsg");

//显示打开弹出层内容
function showAdMsg()
{
    if(divAdMsg)
    {
        divAdMsg.style.display = "";
        divAdMsg.style.top = document.documentElement.scrollTop + parseInt((document.documentElement.clientHeight - divAdMsg.offsetHeight) / 2) + "px";
        divAdMsg.style.left = document.documentElement.scrollLeft + parseInt((document.documentElement.clientWidth - divAdMsg.offsetWidth) / 2) + "px";
        divGg.style.width = document.body.offsetWidth + "px";
        if(document.body.offsetHeight < document.documentElement.scrollTop + document.documentElement.clientHeight)
            divGg.style.height = document.documentElement.scrollTop + document.documentElement.clientHeight + "px";
        else
            divGg.style.height = document.body.offsetHeight + "px";
        divGg.style.display = "";
    }
}
//关闭打开弹出层内容
function closeAdMsg()
{
    divAdMsg.style.display = "none";
    divGg.style.display = "none";
}
	</script>

<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">订单信息</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">

	<tags:guaranteeprint></tags:guaranteeprint>
	<br/>
	
		<table id="contentTable" class="table table-striped table-bordered table-condensed">
<!-- 			<thead> -->
<!-- 				<th style="vertical-align: middle; color: white; " colspan="11" bgcolor="#8EB4CB">订单信息</th> -->
<!-- 			</thead> -->
			<thead><tr>
			   
			    <th><input type="checkbox" name="alreadyMyCheckedAll"
										id="alreadyMyCheckedAll" onclick="alreadyMyCheckedAll()" />
			    </th>
			    <th>序号</th>
			    <th>商家编码</th>
			    <th>店铺编码</th>
			    <th>作业仓库</th>
			    <th>批次编号</th>
			    <th>任务编号</th>
			    <th>保修编号</th>
			    <th>订单编号</th>
			    <th>订单详情</th>
			</tr></thead>
		<tbody>
		<c:forEach items="${orderList}" var="o"  step="1" varStatus="i" >
			<tr>
			  
			   <td><input type="checkbox" name="alreadyMyChecked"
											id="check_already${i.index+1}"
											value="${o.order.ordeno}"
											onclick="alreadyMyChecked(${o.id})" /></td>
			   <td>${i.count}</td>
			   <td>${o.customerCode}</td>
			   <td >${o.order.shopna}</td>
			   <td >${o.warehouseCode}</td>
			   <td >${o.batchCode}</td>
			   <td >${o.taskCode}</td>
			   <td >${taskCode}</td>
			   <td >${o.order.ordeno}</td>
			   <td>
		      	 <a href="#ordersDetailed" onclick="getAjaxOrders('${o.order.id}')" role="button" class="btn btn-default btn-sm" data-toggle="modal">订单详情 </a>
				 <a href="#itemsDetailed" onclick="getAjaxItems('${o.order.id}')" role="button" class="btn btn-default btn-sm" data-toggle="modal"> 商品详情 </a>
			   </td>
			</tr>
		</c:forEach>
		</tbody>
	    </table>
</div></div></div></div>

		<!-- 订单详细信息  窗体--> 
    <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" id="ordersDetailed">
	    <div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<h3>订单详细信息</h3>
				</div>
				<div class="modal-body"  style="height:500px;overflow: auto;">
					<table class="table table-striped table-bordered table-condensed" id="modalBodyOrders"></table>
				</div>
				<div class="modal-footer">
					<button class="btn" data-dismiss="modal" aria-hidden="true">关闭 </button>
				</div>
				</div>
			</div>
		</div>

        <!-- 商品详细信息 窗体 --> 
		<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" id="itemsDetailed">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3>商品详细信息</h3>
					</div>
					<div class="modal-body" style="overflow: auto;">
						<table class="table table-striped table-bordered table-condensed" id="modalBodyItems"></table>
					</div>
					<div class="modal-footer">
					  <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
					</div>
				</div>
			</div>
		</div>
		
</section>
</body>
</html>
